(function ($) {
    "use strict";

	jQuery(document).ready(function($){				
	
		// Owl carousel
		$('.client-list').owlCarousel({
			loop:true,
			margin:70,
			responsiveClass:true,
			autoplay: 5000,
			responsive:{
				0:{
					items:1
				},
				600:{
					items:3
				},
				1000:{
					items:5
				}
			}
		});

		$('.index-banner').owlCarousel({
			loop:true,
			nav:true,
			margin:70,
			navText:['<i class="fa fa-angle-left"></i>','<i class="fa fa-angle-right"></i>'],   
			responsiveClass:true,
			responsive:{
				0:{
					items:1,
				},
				600:{
					items:1,
				},
				1000:{
					items:1,
				}
			}
		}); 

		$('.brand-list').owlCarousel({
			loop:true,
			nav:true,
			margin:70,
			navText:['<i class="fa fa-angle-left"></i>','<i class="fa fa-angle-right"></i>'],   
			responsiveClass:true,
			responsive:{
				0:{
					items:1,
				},
				600:{
					items:5,
				},
				1000:{
					items:6,
				}
			}
		}); 
		
		$('.hot-deal').owlCarousel({
			 loop:true,
			nav:true,
			margin:20,   
			navText:['<i class="fa fa-angle-left"></i>','<i class="fa fa-angle-right"></i>'],   
		  
			responsiveClass:true,
		   
			 
			responsive:{
				0:{
					items:1,
				},
				600:{
					items:3,
				},
				1000:{
					items:4,
				}
			}

		}); 
		
		$('.menclothing-carousel').owlCarousel({
			 loop:true,
			nav:true,
			margin:20,  
			navText:['<i class="fa fa-angle-left"></i>','<i class="fa fa-angle-right"></i>'], 
		  
			responsiveClass:true,
		   
			 
			responsive:{
				0:{
					items:1,
				},
				600:{
					items:3,
				},
				1000:{
					items:4,
				}
			}

		}); 
		
		$('.partners_list_carousel').owlCarousel({
			 loop:true,
			nav:false,
			margin:70,   
		  
			responsiveClass:true,
		   
			 
			responsive:{
				0:{
					items:1,
				},
				600:{
					items:3,
				},
				1000:{
					items:6,
				}
			}

		}); 
		
		// revolution slider
		var revapi;
		revapi = jQuery('.tp-banner').revolution({
			delay: 9000,
			startwidth: 1170,
			startheight: 500,
			hideThumbs: 10,
			fullWidth: "on",
			forceFullWidth: "on"

		});
		
		// TOGGLE MOBILE MENU
		$('.ofm li.m_nav').on('click', function() {
			$(".mobi-menu").slideToggle("slow");
			$(this).find(".mobi-menu").slideToggle("slow");
		}
		);
		$('#cssmenu li.has-sub>a').on('click', function() {
			$(this).removeAttr('href');
			var element = $(this).parent('li');
			if (element.hasClass('open')) {
				element.removeClass('open');
				element.find('li').removeClass('open');
				element.find('ul').slideUp();
			} else {
				element.addClass('open');
				element.children('ul').slideDown();
				element.siblings('li').children('ul').slideUp();
				element.siblings('li').removeClass('open');
				element.siblings('li').find('li').removeClass('open');
				element.siblings('li').find('ul').slideUp();
			}
		});
		$('#cssmenu>ul>li.has-sub>a').append('<span class="holder"></span>');
		(function getColor() {
			var r, g, b;
			var textColor = $('#cssmenu').css('color');
			textColor = textColor.slice(4);
			r = textColor.slice(0, textColor.indexOf(','));
			textColor = textColor.slice(textColor.indexOf(' ') + 1);
			g = textColor.slice(0, textColor.indexOf(','));
			textColor = textColor.slice(textColor.indexOf(' ') + 1);
			b = textColor.slice(0, textColor.indexOf(')'));
			var l = rgbToHsl(r, g, b);
			if (l > 0.7) {
				$('#cssmenu>ul>li>a').css('text-shadow', '0 1px 1px rgba(0, 0, 0, .35)');
				$('#cssmenu>ul>li>a>span').css('border-color', 'rgba(0, 0, 0, .35)');
			} else {
				$('#cssmenu>ul>li>a').css('text-shadow', '0 1px 0 rgba(255, 255, 255, .35)');
				$('#cssmenu>ul>li>a>span').css('border-color', 'rgba(255, 255, 255, .35)');
			}
		})();

		function rgbToHsl(r, g, b) {
			r /= 255, g /= 255, b /= 255;
			var max = Math.max(r, g, b),
				min = Math.min(r, g, b);
			var h, s, l = (max + min) / 2;
			if (max == min) {
				h = s = 0;
			} else {
				var d = max - min;
				s = l > 0.5 ? d / (2 - max - min) : d / (max + min);
				switch (max) {
					case r:
						h = (g - b) / d + (g < b ? 6 : 0);
						break;
					case g:
						h = (b - r) / d + 2;
						break;
					case b:
						h = (r - g) / d + 4;
						break;
				}
				h /= 6;
			}
			return l;
		}
	
	});
	
		

})(jQuery);